var htmlWebpackPlugin = require('html-webpack-plugin');
var path = require("path");

module.exports = {
	entry: ['./src/app.js'],

	output: {
		path: __dirname + '/dist/',
		filename: 'js/[name]-bundle.js'
	},
	module: {
		loaders: [{
			test: /\.js$/,
			loader: 'babel',
			exclude: __dirname + '/node_modules/',
			include: [path.resolve(__dirname, '/src/')],
			query: {
				presets: ['latest']
			}
		}, {
			test: /\.css$/,
			loader: 'style-loader!css-loader!postcss-loader'
		},{
			test :/\.less$/,
			loader :'style-loader!css-loader!postcss-loader!less-loader'
		},{
			test :/\.html$/,
			loader :'html-loader'
		},{
			test:/\.tpl$/,
			loader :'ejs-loader'
		},{
			test:/\.(png|jpg|gif|svg)$/i,
//			loader:'file-loader',
//			query:{
//				name:'assets/[name]-[hash:5].[ext]'
//			}
//			loader:'url-loader',
			loaders:[
				'url-loader?limit=1000&name=assets/[name]-[hash:5].[ext]',
				'image-webpack-loader'
			],
//			use: ['url-loader?limit=1000&name=images/[name]-[hash:5].[ext]','image-webpack-loader']
			/*query:{
				name:'assets/[name]-[hash:5].[ext]',
				limit:1000000
			}*/
			
		}]
	},
	plugins: [
		new htmlWebpackPlugin({
			filename: 'index.html',
			template: 'index.html',
			inject: 'body'
		})
	]
}